package cz.proks.schoolpupilbook.gae.restlet.resource;

import cz.proks.schoolpupilbook.gae.dao.MarkCommentDAO;
import cz.proks.schoolpupilbook.shared.domain.Course;
import cz.proks.schoolpupilbook.shared.domain.MarkComment;
import cz.proks.schoolpupilbook.shared.restlet.RestMapping;
import cz.proks.schoolpupilbook.shared.util.Tester;

public class MarkCommentServerResource extends BaseServerResource implements MarkCommentResource {
	private final MarkCommentDAO dao = new MarkCommentDAO();
	
	@Override
	public MarkComment retrieve() {
		String markCommentId = (String) getRequestAttributes().get(RestMapping.PARAMETER_MARK_COMMENT_ID);		
		
		if (Tester.isEmpty(markCommentId))
			return null;
		
		MarkComment markComment = dao.find(markCommentId);		
		return markComment;
	}

	@Override	
	public void store(MarkComment obj) {						
		dao.save(obj);		
	}
}
